#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <float.h>
#include"gps.h"


int main(int argc, char *argv[])
{
	U1 NmeaOutSeq[7];
	U1 CodeBuiderSeqSort[7];
	U1 CodeBuiderSeq[7] = { 1, 2, 3, 4, 5, 6, 7 };
	U1 i, j, k;
	
	CodeBuiderSeq[0] = 3;
	CodeBuiderSeq[1] = 5;
	CodeBuiderSeq[2] = 4;
	CodeBuiderSeq[3] = 6;
	CodeBuiderSeq[4] = 2;
	CodeBuiderSeq[5] = 1;
	CodeBuiderSeq[6] = 0;
	
	for(i=0;i<7;i++){
		printf("CodeBuiderSeq[%d]=%d\r\n",i,CodeBuiderSeq[i]);
	}
	
	CodeBuiderSeqSort[0] = CodeBuiderSeq[0];
	NmeaOutSeq[0] = 0;
	for (i = 1; i < 7; i++)
	{
		for (k = 0; k < i; k++)
		{
			if (CodeBuiderSeq[i] < CodeBuiderSeqSort[k])
				break;
		}
		for (j = i; j > k; j--)
		{
			CodeBuiderSeqSort[j] = CodeBuiderSeqSort[j - 1];
			NmeaOutSeq[j] = NmeaOutSeq[j - 1];
		}
		CodeBuiderSeqSort[j] = CodeBuiderSeq[i];
		NmeaOutSeq[j] = i;
	}
	
	for(i=0;i<7;i++){
		printf("NmeaOutSeq[%d]=%d\r\n",i,NmeaOutSeq[i]);
	}
	
	return 0;
}

